[Feature] : API ENDPOINTS PR 3 : System Status and Run Management Endpoints#1132
Open
pulk17 wants to merge 3 commits into
Open
[Feature] : API ENDPOINTS PR 3 : System Status and Run Management Endpoints#1132pulk17 wants to merge 3 commits into
pulk17 wants to merge 3 commits into
Conversation
pulk17
requested review from
canihavesomecoffee and
thealphadollar
as code owners
June 24, 2026 10:54
cfsmp3
self-requested a review
June 24, 2026 16:40
cfsmp3
requested changes
Jun 24, 2026
cfsmp3
left a comment
Contributor
There was a problem hiding this comment.
HIGH:
- H2 — the C1 fix is only half-wired. The expected_outputs fix went into batch_get_run_data (run status), but get_run_summary and error_service still call the legacy is_dummy_row path (never matches). So for a run with missing output: derive_run_status says fail (right), but /summary counts it as pass with missing_output_count: 0, and /errors omits it. The endpoints contradict each other, and the headline bug resurfaces in the two endpoints users actually read. No test catches it.
- H3 — arbitrary-repo CI trigger (carryover #1117 H2). POST /runs: is_staff short-circuits ownership, repository is only regex-checked → a contributor can make the build VM clone+build any GitHub repo = arbitrary-code exec on CI infra. Gated by contributor role, but a real privilege expansion.
- H1 — migration still absent (3 PRs deep; all these routes are auth-gated so they need the token table too).
MEDIUM: cancel race (no row lock); status-filter 1000-cap drops rows + inconsistent total; summary total_samples never reconciles; _get_output_artifacts N+1 + paginates after full build; GCS signed URLs without blob.exists.
LOW/NIT: RunSummarySchema unused (raw dict, no contract); step:None dead field; queue hand-builds pagination; generic-exception→JSON path still untested.
pulk17
force-pushed
the
api-pr3-system
branch
8 times, most recently
from
June 25, 2026 16:58
dbf0613 to
a114116
Compare
9 tasks
pulk17
force-pushed
the
api-pr3-system
branch
3 times, most recently
from
June 26, 2026 20:25
fff7f45 to
19c34a9
Compare
This was referenced Jun 29, 2026
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



[FEATURE]
In raising this pull request, I confirm the following (please check boxes):
My familiarity with the project is as follows (check one):
Overview
Third PR of the CI API stack (#1130 → #1141, merge bottom-up). The core read/write surface for CI runs: monitoring endpoints, run listing and detail, and the ability to trigger and cancel runs via the API.
Endpoints
System
GET /system/health— unauthenticated, for monitors and load balancers. Reports overallok/degraded/downplus per-dependency status (database, local storage, GCS). 503 only when down.GET /system/queue— queued and running work withqueue_depth/running_countmeta and?platform/?statusfilters. Queuepositionis only populated under?status=queued, where it's well-defined.Runs
GET /runs— filterable by status, platform, branch, repository, and creation date rangePOST /runs— trigger a run for a commit (runs:write)GET /runs/{id},POST /runs/{id}/cancel,GET /runs/{id}/summary,GET /runs/{id}/config,GET /runs/{id}/progressImplementation notes for reviewers
?status=queuedcomposes with date filters. Queued runs have no progress rows yet, so the date subquery LEFT JOINs progress and treats "no first-progress timestamp" as matching. An inner join here would make?status=queued&created_after=...silently return nothing.POST /runspermission model: the requesting user's GitHub identity must match the target repository (fork owner, or the main repo for maintainers — compared case-insensitively, since GitHub owner names are). The OAuth callback inmod_authnow recordsgithub_loginto support this; this PR is its first consumer. Run creation also verifies a CI build artifact exists for the commit before enqueueing, so the API can't create runs that would instantly fail.TestResultrows is reported aserror(worker finished without reporting), neverpass.Z-suffixed format used across every endpoint in the stack.error_service(structured error derivation, used by run summaries here and expanded in [Feature] : API ENDPOINTS PR 6 : Errors, Logs, and OpenAPI Documentation #1135) andstorage(GCS signed-URL resolution with local-file fallback) services land here with their consumers.The auth middleware integration tests also land in this PR — they need a stable protected endpoint to probe, and
GET /system/queueis it (401 paths: missing/malformed header, bad prefix, wrong hash, revoked, expired; 403 scope paths; prefix-collision resolution;g.api_userpopulation).Testing
61 new tests; 126 total at this layer. Query composition (status × date), permission rejections, cancellation flow, summary/config counting, health degradation paths, and the full middleware-auth matrix.